//
//  BaseViewController.m
//  wuxinlvtu
//
//  Created by Apple on 12-3-3.
//  Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//

#import "BaseViewController.h"

@implementation BaseViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)didReceiveMemoryWarning
{
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc that aren't in use.
}

- (void)dealloc {
    [super dealloc];
}
#pragma mark - View lifecycle

/*
// Implement loadView to create a view hierarchy programmatically, without using a nib.
- (void)loadView
{
}
*/

// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad
{
    [super viewDidLoad];
    UIImageView* backgroudImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
    backgroudImageView.image = [UIImage imageNamed:@"bg_texture.png"];
    [self.view addSubview:backgroudImageView];
    [backgroudImageView release];
    
    UIImageView* headImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 14)];
    [headImageView setImage:[UIImage imageNamed:@"bg_title_adorn.png"]];
    [headImageView setBackgroundColor:[UIColor clearColor]];
    [self.view addSubview:headImageView];
    [headImageView release];
}

- (void)setViewTopHeight:(CGFloat) topY
{
    NSArray* viewArray = [self.view subviews];
    for (int i = 0; i < [viewArray count]; i++) {
        UIView* view = [viewArray objectAtIndex:i];
        [view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y + topY, view.frame.size.width, view.frame.size.height)];
    }
}

- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
//    return (interfaceOrientation == UIInterfaceOrientationPortrait);
    return NO;
}

@end
